From: Mario Sanchez Prada Date: Fri, 23 Mar 2018 21:11:52 +0000 (+0000) Subject: st-private: Add support for letter-spacing in ClutterText based StWidgets X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~929^2~5^2~103 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=376d696b8b073fe9dfad821f8f4d324296533e98;p=gnome-shell.git st-private: Add support for letter-spacing in ClutterText based StWidgets Add support in _st_set_text_from_style(), so that this CSS property can be used from any StWidget holding an internal ClutterText. --- diff --git a/src/st/st-private.c b/src/st/st-private.c index 2bdc29b6c..a0100e094 100644 --- a/src/st/st-private.c +++ b/src/st/st-private.c @@ -116,6 +116,7 @@ _st_set_text_from_style (ClutterText *text, PangoAttrList *attribs = NULL; const PangoFontDescription *font; StTextAlign align; + gdouble spacing; st_theme_node_get_foreground_color (theme_node, &color); clutter_text_set_color (text, &color); @@ -123,11 +124,11 @@ _st_set_text_from_style (ClutterText *text, font = st_theme_node_get_font (theme_node); clutter_text_set_font_description (text, (PangoFontDescription *) font); + attribs = pango_attr_list_new (); + decoration = st_theme_node_get_text_decoration (theme_node); if (decoration) { - attribs = pango_attr_list_new (); - if (decoration & ST_TEXT_DECORATION_UNDERLINE) { PangoAttribute *underline = pango_attr_underline_new (PANGO_UNDERLINE_SINGLE); @@ -143,6 +144,13 @@ _st_set_text_from_style (ClutterText *text, */ } + spacing = st_theme_node_get_letter_spacing (theme_node); + if (spacing) + { + PangoAttribute *letter_spacing = pango_attr_letter_spacing_new ((int)(.5 + spacing) * PANGO_SCALE); + pango_attr_list_insert (attribs, letter_spacing); + } + clutter_text_set_attributes (text, attribs); if (attribs)